
gc()
library(haven)
library(ggplot2)
library(broom)
library(dotwhisker)
library(sjlabelled)
library(Rmisc)
library(stringr)
library(tidyverse)
library(weights)
library(jtools)
library(margins)
library(interplot)
library(janitor)
library(here)
library(nnet)

# Set plot theme:
steph_theme <- list(
  hrbrthemes::theme_ipsum_rc(base_size = 12, grid = "", plot_title_size = 20, axis_text_size = 18),
  theme(legend.position = "top", 
        plot.caption = element_text(hjust = 0, face = "italic"),
        plot.title.position = "plot",
        plot.caption.position =  "plot"))

# Turn off warnings for the time being:
options(warn = -1)
# Turn back on with:
# options(warn = 0)


# ---------------------------------------------------------------------------------------------------------------
# Read in Data:
# ---------------------------------------------------------------------------------------------------------------
Cloud_MTurk <- readRDS("Data/Cloud_MTurk.RDS")
CCES <- readRDS("Data/CCES.RDS")
df <- readRDS("Data/YouGov.RDS")

# ---------------------------------------------------------------------------------------------------------------
# Recoding variables:
# ---------------------------------------------------------------------------------------------------------------
# Treatment recodes:
df$bcv_treat_recode <- car::recode(as.numeric(as.character(df$bcv_treat)), "1 = 'COVID Identified'; 2 = 'COVID Not Reported'; 3 = 'No Extra Info'; else = NA")
df %>%
  mutate(bcv_treat_recode = fct_relevel(df$bcv_treat_recode, "No Extra Info")) -> df
df$Exp3_recode <- car::recode(as.numeric(as.character(df$Exp1)), "1 = 'Control'; 2 = 'Without Source'; 3 = 'With Source'; else = NA")
df %>%
  mutate(messages = fct_relevel(df$Exp3_recode, "Control")) -> df
df$messages <- car::recode(df$messages, "'Control' = 'Control'; 'With Source' = 'RV + SC Message'; 'Without Source' = 'RV Message'")
df$messages <- factor(df$messages, levels = c("Control", "RV Message", "RV + SC Message"))

# Main DV recodes:
df$BR1_recode <- car::recode(as.numeric(as.character(df$BR1)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$BR2_recode <- car::recode(as.numeric(as.character(df$BR2)), "1 = 1; 2 = 2; 3 = 3; 4 = 4; 5 = 5; else = NA")
df$BCV2_recode <- car::recode(as.numeric(as.character(df$BCV2)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$BCV3_recode <- car::recode(as.numeric(as.character(df$BCV3)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$BCV1a_recode <- car::recode(as.numeric(as.character(df$BCV1a)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R3_recode <- car::recode(as.numeric(as.character(df$R3)), "1 = 4; 2 = 3; 3 = 2; 4 = 1; else = NA")

# Demographic recodes:
df$pew_bornagain_recode <- car::recode(as.numeric(as.character(df$pew_bornagain)), "1 = 'Yes'; 2 = 'No'; else = NA")
df$pid_recode <- car::recode(as.numeric(as.character(df$pid3)), "1 = 'Democrat'; 2 = 'Republican'; 3 = 'Independent'; 4 = 'Other'; else = NA")
df$pid7_recode <- car::recode(as.numeric(as.character(df$pid7)), "1= '1-Strong Democrat'; 2 = '2-Not very strong Democrat'; 3 = '3-Lean Democrat'; 4 = '4-Independent'; 5 = '5-Lean Republican'; 6 = '6-Not very strong Republican'; 7 = '7-Strong Republican'; else = NA")
df$gender_recode <- car::recode(as.numeric(as.character(df$gender)), "1 = 'Male'; 2 = 'Female'; else = NA")
df$educ_recode <- car::recode(as.numeric(as.character(df$educ)), "1 = '1-No HS'; 2 = '2-HS'; 3 = '3-Some College'; 4 = '4-2 year'; 5 = '5-4 year'; 6 = '6-Post Grad'; else = NA")
df$educ_recode_dummy_assocabove <- car::recode(as.numeric(as.character(df$educ)), "1:3 = 0; 4:6 = 1; else = NA")
df$educ_recode_dummy_bachabove <- car::recode(as.numeric(as.character(df$educ)), "1:4 = 0; 5:6 = 1; else = NA")
df$ideo5_recode <- car::recode(as.numeric(as.character(df$ideo5)), "1 = '1-Very Liberal'; 2 = '2-Liberal'; 3 = '3-Moderate'; 4 = '4-Conservative'; 5 = '5-Very Conservative'; 6 = '6-Not Sure'; else = NA")
df$ideo5_recode_num <- car::recode(as.numeric(as.character(df$ideo5)), "1 = 1; 2 = 2; 3 = 3; 4 = 4; 5 = 5; else = NA")
df$democrat <- car::recode(as.numeric(as.character(df$pid7)), "1:3 = 1; 5:7 = 0; else = NA")
df$democrat_nolean <- car::recode(as.numeric(as.character(df$pid7)), "1:2 = 1; 6:7 = 0; else = NA")
df$pid7_recode <- car::recode(as.numeric(as.character(df$pid7)), "1 = 7; 2 = 6; 3 = 5; 4 = 4; 5 = 3; 6 = 2; 7 = 1; else = NA")
df$age <- 2021-df$birthyr

# Additional recodes:
df$FT1_1_recode <- car::recode(df$FT1_1, "997 = NA")
df$FT1_1_recode <- as.numeric(as.character(df$FT1_1_recode))
df$E6_recode2 <- car::recode(as.numeric(as.character(df$E6)), "1 = 1; 2:3 = 0; else = NA")
df$C3_recode <- car::recode(as.numeric(as.character(df$C3)), "1 = 4; 2 = 3; 3 = 2; 4 = 1; else = NA")

# Evangelical and Future Scaling:
df$R4_1_recode <- car::recode(as.numeric(as.character(df$R4_1)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_2_recode <- car::recode(as.numeric(as.character(df$R4_2)), "1 = 1; 2 = 2; 3 = 3; 4 = 4; 5 = 5; else = NA")
df$R4_3_recode <- car::recode(as.numeric(as.character(df$R4_3)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_4_recode <- car::recode(as.numeric(as.character(df$R4_4)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_5_recode <- car::recode(as.numeric(as.character(df$R4_5)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_6_recode <- car::recode(as.numeric(as.character(df$R4_6)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_7_recode <- car::recode(as.numeric(as.character(df$R4_7)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_8_recode <- car::recode(as.numeric(as.character(df$R4_8)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_9_recode <- car::recode(as.numeric(as.character(df$R4_9)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$R4_10_recode <- car::recode(as.numeric(as.character(df$R4_10)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
scale_norm <- function(x) (x-min(x, na.rm=T))/(max(x, na.rm=T)-min(x, na.rm=T))
df$FuturePolicy_Scale <- with(df, BCV2_recode + BCV3_recode)
df$FuturePolicy_Scale <- scale_norm(df$FuturePolicy_Scale) 
df$Evangelical_Index <- with(df, R4_1_recode + R4_2_recode + R4_3_recode + R4_4_recode + R4_5_recode + R4_6_recode + R4_7_recode + R4_8_recode + R4_9_recode + R4_10_recode)
df$Evangelical_Index <- scale_norm(df$Evangelical_Index) 

# Partisanship Scaling
df$e4_1_recode <- car::recode(as.numeric(as.character(df$e4_1)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_2_recode <- car::recode(as.numeric(as.character(df$e4_2)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_3_recode <- car::recode(as.numeric(as.character(df$e4_3)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_4_recode <- car::recode(as.numeric(as.character(df$e4_4)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_5_recode <- car::recode(as.numeric(as.character(df$e4_5)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_6_recode <- car::recode(as.numeric(as.character(df$e4_6)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_7_recode <- car::recode(as.numeric(as.character(df$e4_7)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_8_recode <- car::recode(as.numeric(as.character(df$e4_8)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_9_recode <- car::recode(as.numeric(as.character(df$e4_9)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$e4_10_recode <- car::recode(as.numeric(as.character(df$e4_10)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df$Republican_Index <- with(df, e4_1_recode + e4_2_recode + e4_3_recode + e4_4_recode + e4_5_recode + e4_6_recode + e4_7_recode + e4_8_recode + e4_9_recode + e4_10_recode)
df$Republican_Index <- scale_norm(df$Republican_Index) 
df$FT_Evangelicals <- car::recode(df$FT2_1, "997 = NA")
df$FT_Evangelicals <- as.numeric(as.character(df$FT_Evangelicals))
df$FT_Republicans <- car::recode(df$FT3_1, "997 = NA")
df$FT_Republicans <- as.numeric(as.character(df$FT_Republicans))
df$FT_Democrats <- car::recode(df$FT4_1, "997 = NA")
df$FT_Democrats <- as.numeric(as.character(df$FT_Democrats))


df %>%
  filter(E6_recode2 != "") -> df_vote2

df %>%
  filter(C3_recode != "") -> df_approve

df %>%
  dplyr::mutate(pew_prayer_r = as.numeric(as.character(dplyr::recode(as.numeric(pew_prayer), 
                                                                     `1` = '1',
                                                                     `2` = '0.8571426',
                                                                     `3` = '0.7142855',
                                                                     `4` = '0.5714284',
                                                                     `5` = '0.4285713',
                                                                     `6` = '0.2857142',
                                                                     `7` = '0.1428571',
                                                                     .default = "NaN")))) %>%
  dplyr::mutate(pew_churatd_r = as.numeric(as.character(dplyr::recode(as.numeric(pew_churatd), 
                                                                      `1` = '1',
                                                                      `2` = '0.8333335',
                                                                      `3` = '0.6666668',
                                                                      `4` = '0.5000001',
                                                                      `5` = '0.3333334',
                                                                      `6` = '0.1666667',
                                                                      .default = "NaN")))) %>%
  dplyr::mutate(pew_religimp_r = as.numeric(as.character(dplyr::recode(as.numeric(pew_religimp), 
                                                                       `1` = '1',
                                                                       `2` = '0.75',
                                                                       `3` = '0.50',
                                                                       `4` = '0.25',
                                                                       .default = "NaN")))) -> df



df_SPEEDERSINCLUDED <- readRDS("Data/YouGov_Speeders.RDS")
# Treatment recodes:
df_SPEEDERSINCLUDED$bcv_treat_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$bcv_treat)), "1 = 'COVID Identified'; 2 = 'COVID Not Reported'; 3 = 'No Extra Info'; else = NA")
df_SPEEDERSINCLUDED %>%
  mutate(bcv_treat_recode = fct_relevel(df_SPEEDERSINCLUDED$bcv_treat_recode, "No Extra Info")) -> df_SPEEDERSINCLUDED
df_SPEEDERSINCLUDED$Exp3_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$Exp1)), "1 = 'Control'; 2 = 'Without Source'; 3 = 'With Source'; else = NA")
df_SPEEDERSINCLUDED %>%
  mutate(messages = fct_relevel(df_SPEEDERSINCLUDED$Exp3_recode, "Control")) -> df_SPEEDERSINCLUDED
df_SPEEDERSINCLUDED$messages <- car::recode(df_SPEEDERSINCLUDED$messages, "'Control' = 'Control'; 'With Source' = 'RV + SC Message'; 'Without Source' = 'RV Message'")
df_SPEEDERSINCLUDED$messages <- factor(df_SPEEDERSINCLUDED$messages, levels = c("Control", "RV Message", "RV + SC Message"))

# Main DV recodes:
df_SPEEDERSINCLUDED$BR1_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$BR1)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$BR2_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$BR2)), "1 = 1; 2 = 2; 3 = 3; 4 = 4; 5 = 5; else = NA")
df_SPEEDERSINCLUDED$BCV2_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$BCV2)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$BCV3_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$BCV3)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$BCV1a_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$BCV1a)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R3_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R3)), "1 = 4; 2 = 3; 3 = 2; 4 = 1; else = NA")

# Demographic recodes:
df_SPEEDERSINCLUDED$pew_bornagain_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$pew_bornagain)), "1 = 'Yes'; 2 = 'No'; else = NA")
df_SPEEDERSINCLUDED$pid_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$pid3)), "1 = 'Democrat'; 2 = 'Republican'; 3 = 'Independent'; 4 = 'Other'; else = NA")
df_SPEEDERSINCLUDED$pid7_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$pid7)), "1= '1-Strong Democrat'; 2 = '2-Not very strong Democrat'; 3 = '3-Lean Democrat'; 4 = '4-Independent'; 5 = '5-Lean Republican'; 6 = '6-Not very strong Republican'; 7 = '7-Strong Republican'; else = NA")
df_SPEEDERSINCLUDED$gender_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$gender)), "1 = 'Male'; 2 = 'Female'; else = NA")
df_SPEEDERSINCLUDED$educ_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$educ)), "1 = '1-No HS'; 2 = '2-HS'; 3 = '3-Some College'; 4 = '4-2 year'; 5 = '5-4 year'; 6 = '6-Post Grad'; else = NA")
df_SPEEDERSINCLUDED$educ_recode_dummy_assocabove <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$educ)), "1:3 = 0; 4:6 = 1; else = NA")
df_SPEEDERSINCLUDED$educ_recode_dummy_bachabove <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$educ)), "1:4 = 0; 5:6 = 1; else = NA")
df_SPEEDERSINCLUDED$ideo5_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$ideo5)), "1 = '1-Very Liberal'; 2 = '2-Liberal'; 3 = '3-Moderate'; 4 = '4-Conservative'; 5 = '5-Very Conservative'; 6 = '6-Not Sure'; else = NA")
df_SPEEDERSINCLUDED$ideo5_recode_num <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$ideo5)), "1 = 1; 2 = 2; 3 = 3; 4 = 4; 5 = 5; else = NA")
df_SPEEDERSINCLUDED$democrat <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$pid7)), "1:3 = 1; 5:7 = 0; else = NA")
df_SPEEDERSINCLUDED$democrat_nolean <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$pid7)), "1:2 = 1; 6:7 = 0; else = NA")
df_SPEEDERSINCLUDED$pid7_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$pid7)), "1 = 7; 2 = 6; 3 = 5; 4 = 4; 5 = 3; 6 = 2; 7 = 1; else = NA")
df_SPEEDERSINCLUDED$age <- 2021-df_SPEEDERSINCLUDED$birthyr

# Additional recodes:
df_SPEEDERSINCLUDED$FT1_1_recode <- car::recode(df_SPEEDERSINCLUDED$FT1_1, "997 = NA")
df_SPEEDERSINCLUDED$FT1_1_recode <- as.numeric(as.character(df_SPEEDERSINCLUDED$FT1_1_recode))
df_SPEEDERSINCLUDED$E6_recode2 <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$E6)), "1 = 1; 2:3 = 0; else = NA")
df_SPEEDERSINCLUDED$C3_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$C3)), "1 = 4; 2 = 3; 3 = 2; 4 = 1; else = NA")

# Evangelical and Future Scaling:
df_SPEEDERSINCLUDED$R4_1_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_1)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_2_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_2)), "1 = 1; 2 = 2; 3 = 3; 4 = 4; 5 = 5; else = NA")
df_SPEEDERSINCLUDED$R4_3_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_3)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_4_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_4)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_5_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_5)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_6_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_6)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_7_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_7)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_8_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_8)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_9_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_9)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$R4_10_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$R4_10)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
scale_norm <- function(x) (x-min(x, na.rm=T))/(max(x, na.rm=T)-min(x, na.rm=T))
df_SPEEDERSINCLUDED$FuturePolicy_Scale <- with(df_SPEEDERSINCLUDED, BCV2_recode + BCV3_recode)
df_SPEEDERSINCLUDED$FuturePolicy_Scale <- scale_norm(df_SPEEDERSINCLUDED$FuturePolicy_Scale) 
df_SPEEDERSINCLUDED$Evangelical_Index <- with(df_SPEEDERSINCLUDED, R4_1_recode + R4_2_recode + R4_3_recode + R4_4_recode + R4_5_recode + R4_6_recode + R4_7_recode + R4_8_recode + R4_9_recode + R4_10_recode)
df_SPEEDERSINCLUDED$Evangelical_Index <- scale_norm(df_SPEEDERSINCLUDED$Evangelical_Index) 

# Partisanship Scaling
df_SPEEDERSINCLUDED$e4_1_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_1)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_2_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_2)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_3_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_3)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_4_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_4)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_5_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_5)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_6_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_6)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_7_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_7)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_8_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_8)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_9_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_9)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$e4_10_recode <- car::recode(as.numeric(as.character(df_SPEEDERSINCLUDED$e4_10)), "1 = 5; 2 = 4; 3 = 3; 4 = 2; 5 = 1; else = NA")
df_SPEEDERSINCLUDED$Republican_Index <- with(df_SPEEDERSINCLUDED, e4_1_recode + e4_2_recode + e4_3_recode + e4_4_recode + e4_5_recode + e4_6_recode + e4_7_recode + e4_8_recode + e4_9_recode + e4_10_recode)
df_SPEEDERSINCLUDED$Republican_Index <- scale_norm(df_SPEEDERSINCLUDED$Republican_Index) 
df_SPEEDERSINCLUDED$FT_Evangelicals <- car::recode(df_SPEEDERSINCLUDED$FT2_1, "997 = NA")
df_SPEEDERSINCLUDED$FT_Evangelicals <- as.numeric(as.character(df_SPEEDERSINCLUDED$FT_Evangelicals))
df_SPEEDERSINCLUDED$FT_Republicans <- car::recode(df_SPEEDERSINCLUDED$FT3_1, "997 = NA")
df_SPEEDERSINCLUDED$FT_Republicans <- as.numeric(as.character(df_SPEEDERSINCLUDED$FT_Republicans))
df_SPEEDERSINCLUDED$FT_Democrats <- car::recode(df_SPEEDERSINCLUDED$FT4_1, "997 = NA")
df_SPEEDERSINCLUDED$FT_Democrats <- as.numeric(as.character(df_SPEEDERSINCLUDED$FT_Democrats))

df_SPEEDERSINCLUDED %>%
  filter(E6_recode2 != "") -> df_SPEEDERSINCLUDED_vote2

df_SPEEDERSINCLUDED %>%
  filter(C3_recode != "") -> df_SPEEDERSINCLUDED_approve

